package com.yj.testbook_yj.service.impl;

import com.yj.testbook_yj.dao.TextbookInfoDao;
import com.yj.testbook_yj.domain.TextbookInfo;
import com.yj.testbook_yj.service.TextbookService;
import com.yj.testbook_yj.vo.TextbookInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TextbookServiceImpl implements TextbookService {

    @Autowired
    private TextbookInfoDao textbookDao;

    @Override
    public List<TextbookInfo> findAll() {
        return textbookDao.findAll();
    }

    @Override
    public String addTextbookInfo(TextbookInfo textbookInfo) {
        if (textbookDao.addTextbookInfo(textbookInfo)==1){
            return "success";
        }
        return "faile";
    }

    @Override
    public String updateTextbookInfo(TextbookInfo textbookInfo) {
        if (textbookDao.updateTextbookInfo(textbookInfo)==1){
            return "success";
        }
        return "faile";
    }

    @Override
    public String delTextbookInfo(String textbookName) {
        if (textbookDao.delTextbookInfo(textbookName)==1){
            return "success";
        }
        return "faile";
    }

    @Override
    public List<TextbookInfoVO> getTextbookInfoVO() {
        return textbookDao.getTextbookInfoVO();
    }


}
